<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <link rel="icon" href="">
    <link rel="stylesheet" th:href="@{${'/layui/css/layui.css'}}" href="/layui/css/layui.css"/>
</head>
<body>
<form class="layui-form" id="loginform">
    <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-block">
            <input style="width: 200px;" type="text" name="account" required  lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input style="width: 200px;" type="text" name="password" required  lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" type="button" id="loginBtn">登录</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

<script th:src="@{${'/js/jquery-2.1.4.js'}}" src="/js/jquery-2.1.4.js" type="text/javascript"></script>
<script th:src="@{${'/layui/layui.js'}}" src="/layui/layui.js" type="text/javascript"></script>
<script>
    $("#loginBtn").unbind("click").bind("click", function () {
        var account = $("#account").val();
        var password = $("#password").val();
        $.ajax({
            url:"/doLogin",
            type:"post",
            data:{account:account,password:password},
            success:function (data) {
                alert(data);
            }
        })

    });
</script>
</body>
</html>